# # python代码顺序运行，从上到下运行
# print('111')
# print("222")
# print("333")

# # 条件语句
# choice = input("输入1 表示愿意认真学习，输入2 表示躺平摆烂:")
# # 注意这里比较的是字符串
# if choice == "1":
#     print('能够找到好工作')
# elif choice == 2:
#     print("你可能毕业就事业")
# else:
#     print('您的输入有误')

# # 缩进和代码块
# a = input('请输入一个整数：')
# if a == '1':
#     print("aaaa")
#     print("bbbb")

# # 缩进可以嵌套
# a = input('请输入第一个整数：')
# b = input('请输入第二个整数：')
# if a == '1':
#     if b == '2':
#         print("aaa")
#     print("bbb")
# print("ccc")

# # 输入一个数，判断是否是奇数
# a = input("请输入一个数: ")
# a = int(a)
# if a % 2 == 1:
#     print("是奇数")
# else:
#     print("是偶数")

# # 输入一个数，判断是否是正数
# a = input("请输入一个数")
# a = int(a)
# if a > 0:
#     print("是正数")
# elif a < 0:
#     print("是负数")
# else:
#     print("0")

# # 判断闰年
# year = input("请输入一个年份:")
# year = int(year)
# if year % 100 == 0:
#     if year % 400 == 0:
#         print("润年")
#     else:
#         print("平年")
# else:
#     if year % 4 == 0:
#         print("是闰年")
#     else:
#         print("平年")

# # 简化闰年判断
# year = input("请输入一个年份：")
# year = int(year)
# if (year % 400 == 0) or (year % 4 == 0 and year % 100 != 0):
#     print("闰年")
# else:
#     print("平年")

# # 空语句
# a = input("请输入一个数字：")
# if a == '1':
#     pass
# else:
#     print("hello")

# # 打印出前n位数的和
# num = input('请输入一个数：')
# num = int(num)
# sum = 0
# i = 1
# while i <= num:
#     sum = sum + i
#     i += 1
# print(sum)

# # 打印出 1 ~ 10
# i = 1
# while i <= 10:
#     print(i)
#     i += 1

# # 计算 n!
# num = input("请输入一个数字")
# num = int(num)
# result = 1
# i = 1
# while i <= num:
#     result *= i
#     i += 1
# print(result)

# # 阶乘求和 1! + 2! + 3! + ...
# num = input("请输入一个数：")
# num = int(num)
# sum = 0
# i = 1
# while i <= num:
#     j = 1
#     factorial = 1
#     while j <= i:
#         factorial *= j
#         j += 1
#     sum += factorial
#     i += 1
# print(sum)

# # for循环 打印 1~n
# num = input("请输入一个数：")
# num = int(num)
# for i in range(1, num + 1):
#     print(i)

# # 用for循环打印偶数
# num = input("请输入一个数：")
# num = int(num)
# for i in range(1, num + 1):
#     if i % 2 == 0:
#         print(i)

# # 用for循环实现倒序打印
# num = input("请输入一个数")
# num = int(num)
# for i in range(num, 0, -1):
#     print(i)

# # 求前n的和
# num = input("请输入一个数")
# num = int(num)
# Sum = 0
# for i in range(1, num+1):
#     Sum += i
# print(Sum)

# # continue和break
# # 比如找5
# for i in range(1, 10):
#     if i == 5:
#         print(i)
#         break
# # 你不要5
# for i in range (1, 10):
#     if i == 5:
#         continue
#     print(i)

# 求n个数字的平均值
theSum = 0  # 表示和的结果
count = 0   # 表示一共有多少数字
while True:
    num = input("请输入一个数字(分号代表输入结束)：")
    if num == ';':
        # 约定的用户输入 ； 的时候，表示输入结束
        break
    num = float(num)
    count += 1
    theSum += num

print(f'平均值为: {theSum / count}')
